#ifndef __PUBLIC_H__
#define __PUBLIC_H__
#include<unordered_map>

static const int SMALL_BUF_LEN = 128;
static const int MEDIAN_BUF_LEN = 512;
static const int LARGE_BUF_LEN = 1024;

enum COLOR_NUMBER //色号
{
    DEFAULT_COLOR=0,
    INFO_COLOR =36,
    ERROR_COLOR=35,
    DEBUG_COLOR=32,
    FATAL_COLOR=33,
    LINE_COLOR,
    FUNCTION_COLOR,
    FILE_COLOR
};

enum LOG_LEVEL //日志级别
{
    INFO=0,
    ERROR,
    DEBUG,
    FATAL
};

enum LOG_FEILD
{
    LINE_NAME =0,
    FUNCTION_NAME,
    FILE_NAME
};
//日志级别-----对应颜色
static std::unordered_map<LOG_LEVEL,COLOR_NUMBER>LogLevelColor={
    {INFO,INFO_COLOR},
    {ERROR,ERROR_COLOR},
    {DEBUG,DEBUG_COLOR},
    {FATAL,FATAL_COLOR}
};
  //字段----对应颜色
static std::unordered_map<LOG_FEILD,COLOR_NUMBER>logFeildColor={
    {LINE_NAME,LINE_COLOR},
    {FUNCTION_NAME,FUNCTION_COLOR},
    {FILE_NAME,FILE_COLOR}
    };

static std::unordered_map<LOG_LEVEL,std::string>LogLevelTypeString={
    {INFO,"[INFO]"},
    {ERROR,"[ERROR]"},
    {DEBUG,"[DEBUG]"},
    {FATAL,"[FATAL]"}
};

static std::unordered_map<std::string,LOG_LEVEL>LogLevelType={
    {"[INFO]",INFO},
    {"[ERROR]",ERROR},
    {"[DEBUG]",DEBUG},
    {"[FATAL]",FATAL}
};


enum BIZTYPE{//业务类型
    LOGIN=0, //登陆
    REGISTER=1//注册
};


static const std::string IP="127.0.0.1";
static unsigned short PORT=3306;



static const std::string REDIS_IP = "127.0.0.1";
static const std::string MYSQL_IP = "127.0.0.1";
static const unsigned short REDIS_PORT = 6379;

namespace xsy{
    static const unsigned short MYSQLDB_PORT = 3306;
};
static const std::string USER = "root";
static const std::string PASSWORD = "123456"; 
static const std::string DB = "dsf";

#endif